/*
 * @Author: your name
 * @Date: 2021-12-17 11:27:20
 * @LastEditTime: 2022-03-04 10:21:44
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \operation-management-systems\src\api\sell-order-manage\sell-order-manage.js
 */
// // 销售订单管理
import axios from "@/api/axios";
let organizationNo = sessionStorage.getItem("organizationNo")
export default {
  queryPageByCondition(param) {
    param.entity.organizationNo = organizationNo;
    return axios.post("/v3/sale/salesOrder/queryPageByCondition", param);
  },
  add(param) {
    return axios.post("/v3/sale/salesOrder/addOrder", {
      ...param,
      organizationNo: sessionStorage.organizationNo
    });
  },
  edit(param) {
    return axios.post("/v3/sale/salesOrder/edit", param);
  },
  editOrder(param) {
    return axios.post("/v3/sale/salesOrder/editOrder", param);
  },
  // 批量刪除
  delList(list) {
    return axios.post(`/v3/sale/salesOrder/delListByNo?noList=${list}`)
  },
  // 修改订单审核状态
  updateAuditStatus(param) {
    return axios.post("/v3/sale/salesOrder/updateAuditStatus", param);
  },
  // 修改订单完成状态
  updateCompleteStatus(param) {
    return axios.post("/v3/sale/salesOrder/updateCompleteStatus", param);
  },
  queryListBySalesOrderNo(no) {
    return axios.get(`/v3/sale/salesOrderGoods/queryListBySalesOrderNo?salesOrderNo=` + no);
  },
  queryByCondition(params) {
    return axios.post("/v3/sale/salesOrder/queryByCondition", {
      ...params,
      organizationNo: sessionStorage.organizationNo
    });
  },
  queryOutSaleOrder() {
    return axios.get(`/v3/sale/salesOrder/queryOutSaleOrder?organizationNo=${sessionStorage.organizationNo}`);
  },

  // 獲取销售订单數據
  getPagelist(param) {
    return axios.post("/salesOrder/queryPageList", param);
  },
  // queryAlllist() {
  //   return axios.get("/salesOrderItemMapper/queryAll");
  // },
  // 添加
  addSellOrderInfo(formData) {
    formData.organizationNo = JSON.parse(organizationNo);
    return axios.post("/salesOrder/add", formData)
  },
  // 批量刪除
  delSellOrderInfo(list) {
    return axios.post("/salesOrder/delList", { salesOrderIdList: list })
  },
  delSellOrderInfos(salesOrderId) {
    return axios.get(`/salesOrder/del/${salesOrderId}`)
  },
  // 修改
  editSellOrderInfo(formData) {
    // formData.organizationNo = JSON.parse(organizationNo);
    return axios.post("/salesOrder/edit", formData)
  },
  // 修改
  editStatusInfo(formData) {
    // formData.organizationNo = JSON.parse(organizationNo);
    return axios.post("/salesOrder/editStatus", formData)
  },
  // 销售物品
  getItemMapperlist(param) {
    return axios.post("/salesOrderItemMapper/queryPageList", {
      page: param.page,
      size: param.size,
      sort: "timestamp",
      entity: {
        // organizationNo: sessionStorage.organizationNo
      }
    });
  },
  queryAllSellOrder() {
    return axios.post(`salesOrder/queryByCondition`, {})
  }
}

// // 增加
// export const add = data => axios.post("/salesOrder/add", { ...data });

// // 删除
// export const del = salesOrderId =>
//   axios.get(`/salesOrder/del/${salesOrderId}`);

// // 批量删除
// export const delList = salesOrderIdList =>
//   axios.post("/salesOrder/delList", { salesOrderIdList });

// // 修改
// export const update = data => axios.post("/salesOrder/edit", { ...data });

// // 主键查询
// export const query = salesOrderId =>
//   axios.get("/salesOrder/query", { salesOrderId });

// // 分页查询
// export const getPageData = (page = 1, size = 10) =>
//   axios.post("/salesOrder/queryPageList", { page, size });
